<h2> Manage User</h2>
<?php echo form_open('user/updateUser');?>
<?php foreach ($rs as $r)?><? { ?>
	             <div id="addform">     
				<span id="loading"></span>
					<table width=70% border=0 align="center" cellpadding="0" cellspacing="0"> 
					<tr>
						<td width="14%" height="35">Username :	</td><td width="36%" height="35"><input name="user_username" type=text required class="k-textbox" id="username" value="<?php echo $r['user_username'];?>">	</td>
					 
					   <td width="13%" height="35">&nbsp;</td><td width="37%" height="35">&nbsp;</td>
					</tr>
					<tr>
						<td height="35">ชื่อ :	</td><td height="35"><input name="user_fname" type=text class="k-textbox" id="fname" value="<?php echo $r['user_fname'];?>">	</td>
					 
					   <td height="35">สกุล :	</td><td height="35"><input name="user_lname" type=text class="k-textbox" id="lname" value="<?php echo $r['user_lname'];?>">	</td>
					</tr>	
					<tr>
						<td height="35">Email :	</td><td height="35">
						<input name="user_email" type="email"  required class="k-textbox" id="email" placeholder="e.g. myname@example.net" value="<?php echo $r['user_email'];?>" data-email-msg="Email format is not valid" />
				 	</td>
					 
					   <td height="35">โทรศัพท์ :	</td><td height="35"><input name="user_mobile" type=text class="k-textbox" id="mobile" value="<?php echo $r['user_mobile'];?>">	</td>
					</tr>	
					<tr>
						<td height="35">Position :	</td>
						<td height="35">
	 <select name="position_id" id="pos" class="k-selectbox">
      <option value="<?php echo $r['position_id'];?>"><?php echo $r['position_name'];?></option>  
				 	<?php 
					$query = $this->db->get('position');
				 	foreach ($query->result() as $key)
					{
				 	 echo "<option value=\"".$key->position_id."\">".$key->position_name."</option>";
				 	//print_r($key->position_id);
				 	}
				 	?>
					 		 </select> 
							</td>
						<td height="35">Department :	</td>
						<td height="35">
							   <select name="department_id" id="dep" class="k-selectbox">  
							      <option value="<?php echo $r['department_id'];?> "><?php echo $r['department_name'];?> </option>
				 			<?php 
				 			$query = $this->db->get('department');
				 			foreach ($query->result() as $key)
								{
				 echo "<option value=\"".$key->department_id."\">".$key->department_name."</option>";
				 					//print_r($key->position_id);
				 				}
				 			?>
				 		
					 		 </select>  
							</td>
					</tr>
					<tr>
						<td height="35">Factory :	</td>
						<td height="35">
							   <select name="factory_id" id="fac" class="k-selectbox">  
							   <option value="<?php echo $r['factory_id'];?>"><?php echo $r['factory_name'];?></option>
				 			<?php
							$query = $this->db->get('factory');
				 			foreach ($query->result() as $key) 
				 			{
				 					 echo "<option value=\"".$key->factory_id."\">".$key->factory_name."</option>";
				 					//print_r($key->position_id);
				 				}
				 			?>
				 		
					 		 </select>
   							</td>
				 
						<td height="35" colspan=2 align=center><input name="user_id" type="hidden" id="user_id" value="<?php echo $r['user_id']; ?>" />						  <input name="Submit" type="submit" class="k-button" id="submit" value="    Edit Staff    "></td>
					</tr>		
					</table><? } ?>
				   <p>&nbsp;</p>
			<script>
                $(document).ready(function() {
					$("#dep").kendoDropDownList().trigger("change"); 
					$("#fac").kendoDropDownList().trigger("change"); 
					$("#pos").kendoDropDownList().trigger("change"); 
			    });                
            </script>
            <?php echo form_close();?>
